#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;
int c[100010];
int res[100010];

int lowbit(int x)
{
	return x&(-x);
} 

void  insertNode(int num,int value,int maxN)
{
	while(num<=maxN){
		c[num]+=value;
		num+=lowbit(num);
	}
}

int getsum(int k)
{
	int sum=0;
	while(k>0){
		sum+=c[k];
		k=k-lowbit(k);
	}
	return sum;
}
struct cow
{
	int s,e;
	int label;

};
bool cmp(const cow & a,const cow & b)
{
	if(a.e>b.e) return true;
	else if(a.e==b.e){
		return a.s<b.s;
	}
	else return false;
}
cow src[100010];
int main()
{

	int n;
	while(scanf("%d",&n)){
		if(n==0) break;
		memset(res,0,sizeof(res));
		memset(c,0,sizeof(c));
		int temp=0;
		for(int i=0;i<n;i++){
			int x,y;
			scanf("%d%d",&x,&y);
			src[i].s=x+1;
			src[i].e=y+1;
			src[i].label=i+1;
			if(src[i].e>temp) temp=src[i].e;
		}
		sort(src,src+n,cmp);
		for(int i=0;i<n;i++){
			if(i!=0&&src[i].s==src[i-1].s&&src[i].e==src[i-1].e)
				res[src[i].label]=res[src[i-1].label];
			else res[src[i].label]=getsum(src[i].s);
			insertNode(src[i].s,1,temp);
		}
		for(int i=1;i<=n;i++){
			if(i==n) cout<<res[i]<<endl;
			else cout<<res[i]<<" ";
		}
	}
	return 0;
}

